Skip to content

Add a separate file for plugin logs #8253

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 30, 2025
Merged

Conversation

helin24
Copy link
Member

@helin24 helin24 commented Jun 6, 2025

This adds a new class PluginLogger that prints log messages to a separate flutter.log file. Log messages will continue to print to idea.log also because PluginLogger has a parent logger that continues to log there.

The built in FileHandler class manages writing to the file and removing old lines if the file gets too big.

@helin24
Copy link
Member Author

helin24 commented Jun 27, 2025

At the moment, this is the output in flutter.log (any comments on log format?):

2025-06-27 09:34:38 io.flutter.run.daemon.DevToolsServerTask [INFO   ] Finding or starting DevTools  
2025-06-27 09:34:39 io.flutter.FlutterInitializer [INFO   ] Executing Flutter plugin startup for project: hello_external_2  
2025-06-27 09:34:39 io.flutter.FlutterInitializer [INFO   ] Flutter module has been found for project: hello_external_2  

@helin24 helin24 marked this pull request as ready for review June 27, 2025 16:44
@helin24 helin24 requested a review from jwren June 27, 2025 16:45
@helin24 helin24 changed the title [draft] Add a separate file for plugin logs Add a separate file for plugin logs Jun 27, 2025
@helin24 helin24 merged commit 42b9ec4 into flutter:master Jun 30, 2025
8 checks passed
@helin24 helin24 deleted the flutter-log branch June 30, 2025 16:50
Copy link
Contributor

@pq pq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool!

@@ -1,5 +1,6 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="flutter-intellij [runIde]" type="GradleRunConfiguration" factoryName="Gradle">
<log_file alias="flutter" path="$PROJECT_DIR$/build/idea-sandbox/AI-AI-251.23774.16.2511.13338727/log/flutter.log" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be checked in? Will it be the same for everyone? Or is this specific to the build you have on your machine?

catch (IOException e) {
throw new RuntimeException(e);
}
System.setProperty("java.util.logging.SimpleFormatter.format",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Odd that you can't set format properties programmatically. (I see you can use a logging properties file but that's no better.)

Anyway: odd!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants